<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--框架必需start-->
<script type="text/javascript" src="../../libs/js/jquery.js"></script>
<script type="text/javascript" src="../../libs/js/framework.js"></script>
<link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" id="skin" prePath="../../"/>
<link rel="stylesheet" type="text/css" id="customSkin"/>
<!--框架必需end-->
<!--数字分页start-->
<script type="text/javascript" src="../../libs/js/nav/pageNumber.js"></script>
<!--数字分页end-->
</head>
<body>
	<c:if test="${message!=null}">
		<script>
		top.Dialog.alert("${message}");
		</script>
	</c:if>
	
	<div class="box2" panelTitle="功能面板" roller="false">
	<form name="pageform" action="search.do" method="post">
	<table>
		<tr>
			<td>标题：</td>
			<td><input id="query_userName" name="pager.values" value="${pager.values[0] }" type="text"/></td>
			<td><button type="button" onclick="search()"><span class="icon_find">查询</span></button></td>
			<td><button type="button" onclick="resetSearch()"><span class="icon_reload">重置</span></button></td>

		</tr>
	</table>
	<input type="hidden" id="pageNum" name="pager.pageNum" value="${pager.pageNum }">
	<input type="hidden" id="pageSize" name="pager.size" value="${pager.size }">
	</form>
</div>
<div class="box_tool_min padding_top2 padding_bottom2 padding_right5">
	<div class="center">
	<div class="left">
	<div class="right">
		<div class="padding_top5 padding_left10">
		<a href="goToAdd.action" target="_self"><span class="icon_add">新增信息</span></a>
		<div class="box_tool_line"></div>
		<a href="javascript:;" onclick="onDeleteBatch()"><span class="icon_delete">批量删除</span></a>
		<div class="box_tool_line"></div>
		<div class="clear"></div>
		</div>
	</div>		
	</div>	
	</div>
	<div class="clear"></div>
</div> 
	<div id="scrollContent" class="padding_right5">
	<form name="delform" action="deleteBatch.do" method="post">
	<table class="tableStyle" useClick="false"  useCheckBox="true" sortMode="false">
		<tr>
			<th></th>
			<th width="40"><span>编号</span></th>
			<th width="300"><span>标题</span></th>
			<th><span>年份</span></th>
			<th><span>地区</span></th>
			<th><span>添加时间</span></th>
			<th width="80">操作</th>
		</tr>
		<c:forEach items="${list}" var = "guide">
		<tr>
			<td><input type="checkbox" name="idArray" value="${guide.id }"/></td>
			<td>${guide.id }</td>
			<td>${guide.title }</td>
			<td>${guide.year }</td>
			<td>${guide.location }</td>
			<td><fmt:formatDate value="${guide.addDate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			<td>
				<span class="img_edit hand" title="修改" onclick="onEdit('${guide.id }')"></span>
				<span class="img_delete hand" title="删除" onclick="onDelete('${guide.id }')"></span>
			</td>
		</tr>
		</c:forEach>
	</table>
	</form>
	</div>
	<div style="height:35px;">
	<div class="float_left padding5">
		当前第${pager.pageNum }页|数据共${pager.totalSize }条
	</div>
	<div class="float_right padding5">
		<div class="pageNumber" total="${pager.totalSize }" pageSize="${pager.size }" page="${pager.pageNum-1 }" showSelect="true" showInput="true" id="pageContent"></div>
	</div>
	<div class="clear"></div>
</div>
</body>
<script type="text/javascript">
$(function(){
	$("#pageContent").bind("pageChange",function(e,index){
		var pageNum = index+1;
		$("#pageNum").val(pageNum);
		document.pageform.submit();
	});
	$("#pageContent").bind("sizeChange",function(e,num){
		$("#pageSize").val(num);
		document.pageform.submit();
	});
})

function search(){
	$("#pageNum").val(1);
	document.pageform.submit();
}

function resetSearch(){
	$("#pageNum").val(1);
	$("#query_userName").val("");
	$("#query_name").val("");
	document.pageform.submit();
}

function modelWindow(title,url,width,height){
	var diag = new top.Dialog();
	diag.Title = title;
	diag.URL = url;
	diag.Width = width;
	diag.Height = height;
	diag.show();
}
function onEdit(guideId){
	//modelWindow("修改用户信息","account/goToEdit.do?currentId="+accountId,300,220);
	window.location="goToEdit.do?currentId="+guideId;
}
function onDelete(guideId){
	top.Dialog.confirm("确定要删除吗",function(){window.location="guide/delete.do?id="+guideId},function(){return false;})
}
function onDeleteBatch(accountId){
	if($(":checked").size()<=1){
		top.Dialog.alert("没有选择任何元素");
		return false;
	}
	top.Dialog.confirm("确定要删除吗",function(){document.delform.submit();},function(){return false;})
}
</script>
<%request.setAttribute("message",null); %>
</html>